import request from './axios';

export interface INotificationDto {
  notificationId: string;
  clientId: string;
  type: string | null;
  content: string;
  read: boolean;
  createdAt: number;
}

export interface INotificationResponse {
  status: string;
  data: INotificationDto[];
}

export default {
  /**
   * 根据客户ID获取所有通知
   * @param clientId 客户ID
   */
  getNotificationsByClientId: (clientId: string): Promise<INotificationResponse> => {
    return request({
      url: `/notification/client/${clientId}`,
      method: 'get'
    });
  },

  /**
   * 获取客户的未读通知
   * @param clientId 客户ID
   */
  getUnreadNotifications: (clientId: string): Promise<INotificationResponse> => {
    return request({
      url: `/notification/client/${clientId}/unread`,
      method: 'get'
    });
  },

  /**
   * 将通知标记为已读
   * @param notificationId 通知ID
   */
  markNotificationAsRead: (notificationId: string): Promise<{status: string; data: INotificationDto}> => {
    return request({
      url: `/notification/${notificationId}/read`,
      method: 'patch'
    });
  }
}; 